<!DOCTYPE html>
<html>
<head>
    <title>找酒店</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategy.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <script src="/js/common.js"></script>
	<script>

        var currentPage = 1;
        var pages;
        var types;

        $(function () {

            //获取所有的类型
            $.get("/hotels",{pageSize:2,state:2},function (data) {
                $(".hotels").renderValues(data,{
                    handle:function (ele,value) {
                        ele.href = "/hotelPage.html?id=" + value;
                    }
                })
                pages=data.pages;
                types=data.list;
            });

            $(window).scroll(function () {
                if (isEnd()) {
                    if(currentPage){
                        if (currentPage < pages) {
                            currentPage++;
                            $.get("/hotels", {
                                state: 2,
                                currentPage: currentPage,
                                pageSize: 2
                            }, function (data) {
                                $.merge(types, data.list);
                                renderView({list: types});
                            }, "json");
                        }else {
                            $(document).dialog({
                                type: "notice",
                                infoText: "已经到底部了",
                                autoClose: 1500,
                                position: "center"
                            });
                        }
                    }
                }
            })
        });
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="index.html">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
                <input class="form-control searchBtn" placeholder="找酒店">
            </div>
        </div>
    </div>
</div>

<div class="tab-content" id="pills-tabContent">
    <div class="tab-pane fade active show" id="pills-top">
        <div class="container hotels">
            <h6>酒店类型</h6>
            <div class="row hot" render-loop="list">
                <div class="col-4">
                    <a href="hotelPage.html" render-key="list.id" render-fun="handle">
                        <img render-src="list.coverUrl">
                        <p render-html="list.name"></p>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>